package com.pro.controller;/**
 * @Author 许振杰
 * @Date 2022/2/8 0008 9:49
 * @Version 1.0
 */

import com.pro.mapper.JsApplyRecordMapper;
import com.pro.pojo.*;
import com.pro.service.JsApplyRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
* @Title: 创作者管理controller层
* @author 许振杰
* @date 2022/2/17 0017 10:59
* @version V1.0
*/
@Controller
@RequestMapping(value = "applyRecord")
public class JsApplyRecordController {
    @Autowired
    private JsApplyRecordService applyRecordService;

    /**
    * @Title: 创作者申请列表
    * @author 许振杰
    * @date 2022/2/8 0008 9:50
    * @version V1.0
    */
    @RequestMapping(value = "getApplyRecord")
    @ResponseBody
    public JsonData getApplyRecord(JsApplyRecord applyRecord){
        List<JsApplyRecordMapper> record = applyRecordService.getApplyRecord(applyRecord);
        return record != null ? JsonData.buildSuccess(record) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 根据不同的状态查询不同的用户审核
    * @author 许振杰
    * @date 2022/2/8 0008 10:49
    * @version V1.0
    */
    @RequestMapping(value = "getApplyRecordByResult")
    @ResponseBody
    public JsonData getApplyRecordByResult(Integer result){
        List<JsApplyRecord> applyRecordByResult = applyRecordService.getApplyRecordByResult(result);
        return applyRecordByResult != null ? JsonData.buildSuccess(applyRecordByResult) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 修改审核状态
    * @author 许振杰
    * @date 2022/2/8 0008 11:33
    * @version V1.0
    */
    @RequestMapping(value = "editApplyRecordById")
    @ResponseBody
    public JsonData editApplyRecordById(JsApplyRecord applyRecord){
        boolean editApplyRecordById = applyRecordService.editApplyRecordById(applyRecord);
        return editApplyRecordById ? JsonData.buildSuccess(editApplyRecordById) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 添加审核日志
    * @author 许振杰
    * @date 2022/2/8 0008 13:40
    * @version V1.0
    */
    @RequestMapping(value = "addAuditLog")
    @ResponseBody
    public JsonData addAuditLog(JsAuditLog auditLog){
        boolean addAuditLog = applyRecordService.addAuditLog(auditLog);
        return addAuditLog ? JsonData.buildSuccess(addAuditLog) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 添加审核记录
    * @author 许振杰
    * @date 2022/2/8 0008 14:27
    * @version V1.0
    */
    @RequestMapping(value = "addCourseRecord")
    @ResponseBody
    public JsonData addCourseRecord(JsCourseRecord courseRecord){
        boolean addCourseRecord = applyRecordService.addCourseRecord(courseRecord);
        return addCourseRecord ? JsonData.buildSuccess(addCourseRecord) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 已处理申请列表
    * @author 许振杰
    * @date 2022/2/8 0008 15:26
    * @version V1.0
    */
    @RequestMapping(value = "getApplicationProcessedList")
    @ResponseBody
    public JsonData getApplicationProcessedList(JsApplyRecord applyRecord){
        List<JsApplyRecord> applicationProcessedList = applyRecordService.getApplicationProcessedList(applyRecord);
        return applicationProcessedList !=null ? JsonData.buildSuccess(applicationProcessedList) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 创作者审核日志
    * @author 许振杰
    * @date 2022/2/8 0008 16:36
    * @version V1.0
    */
    @RequestMapping(value = "getAuditLog")
    @ResponseBody
    public JsonData getAuditLog(JsAuditLog auditLog){
        List<JsAuditLog> getAuditLog = applyRecordService.getAuditLog(auditLog);
        return getAuditLog !=null ? JsonData.buildSuccess(getAuditLog) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 根据不同的状态展示不同的审核日志状态
    * @author 许振杰
    * @date 2022/2/8 0008 16:59
    * @version V1.0
    */
    @RequestMapping(value = "getAuditLogByType")
    @ResponseBody
    public JsonData getAuditLogByType(JsAuditLog auditLog){
        List<JsAuditLog> auditLogByType = applyRecordService.getAuditLogByType(auditLog);
        return auditLogByType !=null ? JsonData.buildSuccess(auditLogByType) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 删除审核日志
    * @author 许振杰
    * @date 2022/2/8 0008 18:55
    * @version V1.0
    */
    @RequestMapping(value = "delAuditLog")
    @ResponseBody
    public JsonData delAuditLog(Integer auditLogId){
        boolean delAuditLog = applyRecordService.delAuditLog(auditLogId);
        return delAuditLog ? JsonData.buildSuccess(delAuditLog) : JsonData.buildError("服务器出错了");
    }
    /**
     * @Author 祖铭泽
     * @Date 2022/2/17/0014
     * @description 查询正在申请创作者的数量
     */
    @RequestMapping(value = "getApplyForApplyRecordCount")
    @ResponseBody
    public JsonData getApplyForApplyRecordCount(Integer result) {
        return applyRecordService.getApplyForApplyRecordCount(result);
    }

}
